import Mock from 'mockjs'

/**
 * 分页获取线索列表
 */
export const getEnrollCluePage = async (
  params: pagination & EnrollClue
): Promise<ResEnrollClueList> => {
  const res = await Mock.mock({
    'list|10': [
      {
        'id|+1': 1,
        submit_user_id: '@integer(1, 100)',
        submit_user_name: '@cname',
        name: '@cname',
        phone: '@integer(13000000000, 18999999999)',
        address: '@county(true)',
        createTime: 1691143890537,
        comment: '@cparagraph(1, 3)',
        registered: '@integer(0,1)'
      }
    ],
    pageNo: 1,
    pageSize: 10,
    total: 30
  })
  return res
}

/**
 * 获取线索详情
 */
export const getEnrollClue = async (id: number): Promise<EnrollClue> => {
  const res = await Mock.mock({
    data: {
      'id|+1': 1,
      name: '@cname',
      phone: '@integer(13000000000, 18999999999)',
      address: '@county(true)',
      createTime: '1691480040976',
      comment: '@cparagraph(1, 3)',
      submit_user_id: '@integer(1, 100)',
      submit_user_name: '@cname',
      registered: '@integer(0,1)'
    }
  })
  return res
}

/**
 * 新增线索
 */
export const createEnrollClue = async (params: EnrollClue): Promise<ResStatus> => {
  const res = await Mock.mock({
    isSuccess: true
  })
  return res
}

/**
 * 删除线索
 * @param {number} id
 */
export const deleteEnrollClue = async (id: number): Promise<ResStatus> => {
  const res = await Mock.mock({
    isSuccess: true
  })
  return res
}

/**
 * 更新线索
 * @param {WebVideo} params
 */
export const updateEnrollClue = async (params: EnrollClue): Promise<ResStatus> => {
  const res = await Mock.mock({
    isSuccess: true
  })
  return res
}
